package userInfo;
import JDBC.DBHelper;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserInfoDaoimp implements UserInfoService{
    @Override
    public void createInfo(String uname, String phone, String area, String psinfo, String user1) {
        Connection conn= DBHelper.getConn();
        String sql="INSERT userinfo(username,phone,area,psinfo,user) VALUE (?,?,?,?,?);";
        PreparedStatement stat=null;
        ResultSet rs=null;
        try{
            stat=conn.prepareStatement(sql);
            stat.setString(1, uname);
            stat.setString(2, phone);
            stat.setString(3, area);
            stat.setString(4, psinfo);
            stat.setString(5,user1);//插入用户
            stat.executeUpdate();
            System.out.println("添加成功");
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            DBHelper.closeAll(conn,stat,rs);
        }
    }
    }
